package chapter.fourth.item17;

import java.util.Date;

public class Sub extends Super {
	
	private final Date date;
	
	public Sub(){
		date = new Date();
	}
	
	@Override
	protected void overrideMe() {
		System.out.println(date);
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((date == null) ? 0 : date.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Sub other = (Sub) obj;
		if (date == null) {
			if (other.date != null)
				return false;
		} else if (!date.equals(other.date))
			return false;
		return true;
	}
	
	

	@Override
	public String toString() {
		return "Sub"+Math.random()*1000;
	}

	public static void main(String[] args) {
		Sub sub = new Sub();
		sub.overrideMe();
	}
	
}
